<template>
  <view class="container">
    <!-- 内容卡片 -->
    <view class="card">
      <!-- 表头 -->
      <view class="table-header">
        <text class="header-cell">日期</text>
        <text class="header-cell" style="text-align: right;">营业额</text>
      </view>
      <!-- 数据列表 -->
      <scroll-view scroll-y class="table-body">
        <view class="table-row" v-for="(item, idx) in dataList" :key="idx">
          <text class="cell">{{ item.date }}</text>
          <text class="cell" style="text-align: right;">{{ item.amount }}</text>
        </view>
      </scroll-view>
    </view>
  </view>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { onBackPress } from '@dcloudio/uni-app'

const dataList = ref([])

const getList = () => {
  // 模拟数据
  dataList.value = Array(15).fill({
    date: '2025-06-02',
    amount: '5647.25'
  })
}

const goBack = () => {
  uni.navigateBack()
}

onMounted(() => {
  getList()
})
</script>

<style scoped>
.container {
  min-height: 100vh;
  background: #f6fafd;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.navbar {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  background: transparent;
}
.title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
}
.card {
  margin: 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.table-header {
  display: flex;
  background: #f3f6fb;
  padding: 12px 16px;
  font-weight: bold;
  font-size: 15px;
  color: #333;
  justify-content: space-between;
}
.header-cell {
  flex: 1;
}
.table-body {
  flex: 1;
  max-height: 70vh;
}
.table-row {
  display: flex;
  padding: 12px 16px;
  border-bottom: 1px solid #f3f6fb;
  font-size: 15px;
  color: #555;
}
.cell {
  flex: 1;
}
</style>